package cn.wsalix.shop.service.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.anlaser.service.impl.SimpleServiceImpl;
import cn.anlaser.utils.SearchFilter;
import cn.wsalix.shop.entity.Financial;
import cn.wsalix.shop.form.FinancialForm;
import cn.wsalix.shop.repository.FinancialRepository;
import cn.wsalix.shop.service.FinancialService;

@Service("financialService")
public class FinancialServiceImpl extends
		SimpleServiceImpl<FinancialForm,FinancialRepository, Financial> implements
		FinancialService {
	@Autowired
	private FinancialRepository financialRepository;

	@Override
	public String module() {
		return "/admin/financial";
	}

	@Override
	public FinancialRepository getRepository() {
		return financialRepository;
	}

	@Override
	public Class<Financial> getEntityClazz() {
		return Financial.class;
	}

	@Override
	public Map<String, SearchFilter> buildByForm(FinancialForm form) {
		Map<String, Object> searchParams = new HashMap<String, Object>();
		Map<String, SearchFilter> filters = SearchFilter.parse(searchParams);
		/*if (form.getParentId() != null && form.getParentId() != 0) {
			filters.put("parent.id", new SearchFilter("parent.id",
					Operator.EQ, form.getParentId()));
		}*/
		return filters;
	}

}
